﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;

namespace commonlib
{
    [Serializable]
    public class SystemComponent
    {
        public TRANSACTION_STATES state
        {
            get;
            set;
        }

        public STATES connectionState
        {
            get;
            set;
        }

        public string name
        {
            get;
            set;
        }

        public string centralAdress
        {
            get;
            set;
        }

        public int centralPort
        {
            get;
            set;
        }

        public long id
        {
            get;
            set;
        }

        public IPAddress ipAddress
        {
            get;
            set;
        }

        public int port
        {
            get;
            set;
        }

        public int requestUpdateSystemTimeOut
        {
            get;
            set;
        }

        public List<DataServer> registeredDataServers
        {
            get;
            set;
        }

        public List<Client> registeredClients
        {
            get;
            set;
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("                     id: " + this.id+" \n");
            builder.Append("              ipAddress: " + this.ipAddress + " \n");
            builder.Append("                   port: " + this.port + " \n");
            builder.Append("total known DataServers: " + this.registeredDataServers.Count + " \n");
            builder.Append("    total known Clients: " + this.registeredClients.Count + " \n");

            return builder.ToString();
        }
    }
}
